import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
//导入全局css
import './assets/css/global.css'
// 引入echarts
import echarts from 'echarts'
Vue.prototype.echarts = echarts;

//引入axios
import axios from "axios";
//设置axios的基础路径
axios.defaults.baseURL="http://localhost:80/";
// axios.defaults.baseURL="http://localhost:5001/"

//axios设置它的请求拦截器-------->在请求头设置token内容
axios.interceptors.request.use(config=>{
  var token = sessionStorage.getItem("token");
  if (token){
    config.headers.token=token;
  }
  return config;
})

//把axios挂载到vue上
Vue.prototype.$http=axios;
Vue.config.productionTip = false;

new Vue({
  router,
  render: h => h(App)
}).$mount('#app');
